//深度优先遍历

import java.util.*;
public class Solution {

    public static void elegent(int r2){
        int result=0;
        float y=0;
        int r = (int)Math.floor(Math.sqrt(r2));
        for(int i=0; i<=r; i++){
            y = (int)Math.sqrt(r2-i*i);
            if(i*i + y*y ==r2){
                if(i==0 || y==0)
                    result += 2;
                else
                    result += 4;
            }
        }
        System.out.println(result);
    }
    public static void main(String args[]){
        elegent(204864885);
//        Scanner s = new Scanner(System.in);
//        int r2 = s.nextInt();
//        elegent(r2);
    }
}